<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <!-- <a href="#/login">登录</a>
    <a href="#/register">注册</a> -->

    <router-link to="/login">登录</router-link>
    <router-link to="/register">注册</router-link>

    <router-view></router-view>
    <!-- <login></login>
    <register></register> -->
  </div>
  <script src="libs/vue.js"></script>
  <script src="libs/vue-router.js"></script>
  <script>
    var login = {
      template: '<h1>登录组件</h1>'
    }
    var register = {
      template: '<h1>注册组件</h1>'
    }
    var routerObj = new VueRouter({
      routes: [
        // { path: '/', component: login },
        { path: '/', redirect: '/login' },
        { path: '/login', component: login },
        { path: '/register', component: register }
      ]
    })
    var vm = new Vue({
      el: '#app',
      components: {
        login,
        register
      },
      router: routerObj
    })
  </script>
</body>
</html>